﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="PrintQuotation.aspx.cs" Inherits="PMS.UI.CM.PrintQuotation" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
      
        var Id = com.get.Id;
        var quotData = undefined;
        $(function () {

            //加载客户信息
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/Logic/CM/QuotationAjax.aspx?method=GetQuotCustomerByID",
                data: { "id": Id },
                asyn: false,
                success: function (data) {
                    quotData = data;
                    //加载页头表格
                    $("#Code").html(data.Code);
                    $("#Email").html(data.Email);
                    $("#SignDate").html(data.SignDate);
                    $("#CustomerNameB").html(data.ComName);
                    $("#ComAddress").html(data.ComAddress);
                    $("#Phone").html(data.Phone);
                    $("#Fax").html(data.Fax);
                    $("#MobilePhone").html(data.MobilePhone);
                    $("#RecieverB").html(data.Person);
                    
                    //条形码
                    JsBarcode("#imgBarcode", data.Code, {
                        width: 2.6,//设置条之间的宽度
                        height: 64,//高度
                        displayValue: false,//是否在条形码下方显示文字
                    });

                    //加载产品信息
                    $.ajax({
                        type: "POST",
                        dataType: "json",
                        url: "/Logic/CM/QuotationAjax.aspx?method=GetAllProductDetailForQuotPrint",
                        data: { "quotID": Id },
                        asyn: false,
                        success: function (pData) {
                            LoadDetailData(pData);
                        }
                    });
                }
            });

            $("#btnPrint").click(function () {
                var deadLine = $("#deadLineInput").val();
                $("#deadLine").html(deadLine);
                $("#deadLine").show();
                $("#deadLineInput").hide();
                $("#divPrint").print({
                    globalStyles: true,//是否包含父文档的样式，默认为true
                    mediaPrint: false,//是否包含media='print'的链接标签。会被globalStyles选项覆盖，默认为false
                    stylesheet: null,//外部样式表的URL地址，默认为null
                    noPrintSelector: ".no-print",//不想打印的元素的jQuery选择器，默认为".no-print"
                    iframe: true,//是否使用一个iframe来替代打印表单的弹出窗口，true为在本页面进行打印，false就是说新开一个页面打印，默认为true
                    append: null,//将内容添加到打印内容的后面
                    prepend: null,//将内容添加到打印内容的前面，可以用来作为要打印内容
                    deferred:
                 $.Deferred(

                        )//回调函数
                });
            });
        })

        function LoadDetailData(data) {
            var content = "";
            var price = 0;
            for (var i = 0; i < data.length; i++) {
                content += "<tr>";
                content += "<td style='font-size:16px; text-align:center'>";
                content += i + 1;
                content += "</td>";

                content += "<td style='font-size:16px'>";
                content += data[i].ProductName;
                content += "</td>";

                content += "<td style='font-size:16px'>";
                //content += data[i].TechParams;
                content += com.ConvertLowerAndUper(data[i].TechParams, data[i].IsPureGas);
                content += "</td>";

                content += "<td style='font-size:16px; text-align:center'>";
                content += data[i].BottleVolume;
                content += "</td>";

                content += "<td style='font-size:16px; text-align:center'>";
                content += data[i].OrderCount;
                content += "</td>";

                content += "<td style='font-size:16px; text-align:center'>";
                content += data[i].SinglePrice;
                content += "</td>";

                //钢品信息
                content += "<td style='font-size:16px; text-align:center'>";
                content += data[i].BottleCount;
                content += "</td>";

                content += "<td style='font-size:16px; text-align:center'>";
                content += data[i].BottlePrice;
                content += "</td>";

                content += "<td style='font-size:16px; text-align:center'>";
                content += data[i].TotalPrice;
                content += "</td>";

                content += "</tr>";
                price += data[i].TotalPrice;
            }
            content += "<tr>";
            content += "<td style='font-size:16px;text-align:center' rowspan='2' >备注:</td>"
            content += "<td style='font-size:16px' colspan='2' rowspan='2'>" + quotData.Note + "</td>"
            content += "<td style='font-size:16px;text-align:center' colspan='3' >合同金额(小写):</td>"
            content += "<td style='font-size:16px;text-align:center' colspan='3'>" + price + "</td>"
            content += "</tr>";
            content += "<tr>";
            content += "<td style='font-size:16px;text-align:center' colspan='3'>合同金额(大写):</td>"
            content += "<td style='font-size:16px;text-align:center' colspan='3' >" + moneyToChi(price) + "</td>"
            content += "</tr>";
            $("#detailBody").html("");
            $("#detailBody").append(content);
        }

        //金额转大写
        function moneyToChi(num) {
            if (isNaN(num)) return "";
            var strPrefix = "";
            if (num < 0) strPrefix = "(负)";
            num = Math.abs(num);
            if (num >= 1000000000000) return "无效数值！";
            var strOutput = "";
            var strUnit = '仟佰拾亿仟佰拾万仟佰拾元角分';
            var strCapDgt = '零壹贰叁肆伍陆柒捌玖';
            num += "00";
            var intPos = num.indexOf('.');
            if (intPos >= 0) {
                num = num.substring(0, intPos) + num.substr(intPos + 1, 2);
            }
            strUnit = strUnit.substr(strUnit.length - num.length);
            for (var i = 0; i < num.length; i++) {
                strOutput += strCapDgt.substr(num.substr(i, 1), 1) + strUnit.substr(i, 1);
            }
            return strPrefix + strOutput.replace(/零角零分$/, '整').replace(/零[仟佰拾]/g, '零').replace(/零{2,}/g, '零').replace(/零([亿|万])/g, '$1').replace(/零+元/, '元').replace(/亿零{0,3}万/, '亿').replace(/^元/, "零元");
        }

    </script>
</asp:Content>



<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
</asp:Content>


<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <input type="button" id="btnPrint" value="打印" style="height: 28px; width: 100px" />
    <div id="divPrint" style="margin-top: 20px; width: 1000px">
        <div id="divBZWZ" style="margin-left: 20px; text-align: left; float: left">
            <label style="font-size: 64px; font-weight: bold; font-family: Simsun,Times New Roman; margin-left: 20px; float: left">工业品报价单</label>
        </div>
        <div>
            <img id="imgBarcode" style="float: right; margin-right: 30px;" src="#" />
        </div>
        <div class="clear" style="height: 10px"></div>
         <span style="font-size: 16px; font-family: Simsun; margin-left: 40px">报价单编号：<span style="font-size: 16px; font-family: Simsun;" id="Code"></span></span><br />
        <table id="headTab" style=" word-wrap:break-word;word-break:break-all">
            <tbody>
                <tr>
                    <td style="width: 400px; font-size: 16px">报价人：胡州飞</td>
                    <td style="width: 400px; font-size: 16px">接件人：<span style="font-size: 16px; font-family: Simsun;" id="RecieverB"></span></td>
                </tr>
                <tr>
                    <td style="width: 400px; font-size: 16px">单  位：杭州新世纪混合气体有限公司</td>
                    <td style="width: 400px; font-size: 16px">单  位：<span style="font-size: 16px; font-family: Simsun;" id="CustomerNameB"></span></td>
                </tr>
                <tr>
                    <td style="width: 400px; font-size: 16px">地  址：杭州市余杭区仁和街道东风村</td>
                    <td style="width: 400px; font-size: 16px">地  址：<span style="font-size: 16px; font-family: Simsun;" id="ComAddress"></span></td>
                </tr>
                <tr>
                    <td style="width: 400px; font-size: 16px">电  话：0517-88132888</td>
                    <td style="width: 400px; font-size: 16px">电  话：<span style="font-size: 16px; font-family: Simsun;" id="Phone"></span></td>
                </tr>
                <tr>
                    <td style="width: 400px; font-size: 16px">传  真：0517-86395688</td>
                    <td style="width: 400px; font-size: 16px">传  真：<span style="font-size: 16px; font-family: Simsun;" id="Fax"></span></td>
                </tr>
                <tr>
                    <td style="width: 400px; font-size: 16px">E-mail：</td>
                    <td style="width: 400px; font-size: 16px">E-mail：<span style="font-size: 16px; font-family: Simsun;" id="Email"></span></td>
                </tr>
                <tr>
                    <td style="width: 400px; font-size: 16px">手  机：</td>
                    <td style="width: 400px; font-size: 16px">手  机：<span style="font-size: 16px; font-family: Simsun;" id="MobilePhone"></span></td>
                </tr>
                <tr>
                    <td style="width: 400px; font-size: 16px">报价时间：<span style="font-size: 16px; font-family: Simsun;" id="SignDate"></span></td>
                    <td style="width: 400px; font-size: 16px">类  别：直接客户</td>
                </tr>
            </tbody>
        </table>
        <span style="font-size: 20px; font-family: Simsun;margin-top: 20px; margin-left: 40px">产品报价</span><br />
        <table id="tbDetail" style=" word-wrap:break-word;word-break:break-all">
            <tr>
                <td style="width: 60px; font-size: 20px; text-align: center">序号</td>
                <td style="font-size:20px; width: 200px; text-align: center">产品名称</td>
                <td style="width: 240px; font-size: 20px; text-align: center">产品详细参数</td>
                <td style="width: 60px; font-size: 20px; font-family: Simsun; text-align: center">规格/L</td>
                <td style="width: 80px; font-size: 20px; font-family: Simsun; text-align: center">数量/瓶</td>
                <td style="width: 80px; font-size: 20px; font-family: Simsun; text-align: center">单价/元</td>
                <td style="width: 80px; font-size: 20px; font-family: Simsun; text-align: center">钢品数量/瓶</td>
                <td style="width: 80px; font-size: 20px; font-family: Simsun; text-align: center">钢瓶单价/元</td>
                <td style="width: 80px; font-size: 20px; font-family: Simsun; text-align: center">小计/元</td>
            </tr>
            <tbody id="detailBody">
            </tbody>
        </table>
        <style type="text/css">
            table {
                border-collapse: collapse;
                border: 1px solid;
                margin-left: 40px;
                width: 880px;
            }

            td {
                border: 1px solid;
                font-size: 24px;
                font-family: Simsun,'Times New Roman';
                text-align: left;
            }

            #divPrint span {
                line-height: 26pt;
            }
        </style>

        <div style="margin-top: 0px; margin-left: 40px; margin-right: 60px">
            <span style="font-size: 20px; font-family: Simsun;">您如果确认订货，请尽快通知我们，我们会呈上正式订货合同。谢谢！ 恭候回复！</span><br />
            <hr style="height:3px;border:none;border-top:2px solid black;" /> 
            <span style="font-size: 20px; font-family: Simsun; margin-top: 20px;margin-right: 60px">注意： 供方保证产品的质量与技术规格相符，鉴于化学品的特殊性，供方仅对有效期内未使用的产品的质量和有效检验期内的包装物的安全负责，对产品的应用不负有直接与间接的责任。供方诚意提醒需方在使用之前，应了解该产品及包装物的技术及安全特性并按照有关技术规范检验产品质量和使用及贮存产品，需方如无相关资料，可向供方索取。谢谢合作!</span><br />
            <hr style="height:3px;border:none;border-top:2px solid black;" /> 
            <span style="font-size: 20px; font-family: Simsun;">其他说明：</span><br />
            <span style="font-size: 20px; font-family: Simsun;"><b style="font-size: 20px">价格说明：</b> 该价格含税含运费，开具13%增值税专用发票。</span><br />
            <span style="font-size: 20px; font-family: Simsun;"><b style="font-size: 20px">付款方式：</b> 款到发货/月结/货到付款。</span><br />
            <span style="font-size: 20px; font-family: Simsun;"><b style="font-size: 20px">交货期：</b> 签订合同，按客户订购数量，合理要求具体而定。</span><br />
            <span style="font-size: 20px; font-family: Simsun;"><b style="font-size: 20px">收款人：杭州新世纪混合气体有限公司</b></span><br />
            <span style="font-size: 20px; font-family: Simsun;"><b style="font-size: 20px">开户银行：工行杭州市半山支行</b></span><br />
            <span style="font-size: 20px; font-family: Simsun;"><b style="font-size: 20px">账号：1202 0200 1990 0012 618</b></span>
        </div>

    </div>

</asp:Content>

